package cn.skyquant.quant4j.jforex.sdk.strategy2;

import com.dukascopy.api.IOrder;

public class OrderProxy {
    public final OrderLabel label;
    public final AbstractComment comment;
    public final IOrder order;
    private final boolean valid;

    public boolean isMatch(AbstractConfig config) {
        return valid
                && order != null
                && label != null
                && label.name != null
                && config != null
                && label.configIndex == config.index
                && label.name.equals(config.name)
                && label.eaId == config.eaId;
    }


    public OrderProxy(IOrder order, AbstractComment abstractComment) {
        this.order = order;
        this.label = new OrderLabel(order.getLabel());
        this.comment = abstractComment;
        abstractComment.init(order.getComment());
        this.valid = comment.isValid() && label.valid;
    }
}
